<?php
namespace Home\Controller;
use Think\Controller;
class IndexController extends BaseController {
    public function index(){

        $navigation = M("navigation") -> select();
        $FriendlinkInfo = M("friend_link") -> select();
        $SysconfigInfo = M("sysconfig") -> select();
        $this -> assign("navigation",$navigation);
        $this->assign('FriendlinkInfo',$FriendlinkInfo);
         $this->assign('SysconfigInfo',$SysconfigInfo);
        $this->display();
    
    	// session_start();
    	// if(!isset($_SESSION["admin_member"])){
    	// 	header("location:".U('Admin/Login/index'));
    	// }
    	// //查找角色名称
    	// $role_id=$_SESSION["role_id"];
    	// $M = M("admin_role");
    	// $admin_role=$M->where("id='$role_id'")->select();
    	// $admin_role=$admin_role[0]["role_name"];
    	// $_SESSION["admin_role"]=$admin_role;
     //    /*
     //     * 判断所属角色的权限
     //     */
     //    $sql="select * from (select * from y_admin_role INNER JOIN y_admin_access on id=role_id) a,y_admin_node b where a.node_id=b.id and role_name='$admin_role'";
     //    $M = M();
     //    $admin_access=$M->query($sql);
     //    $role_name=array();
     //    $role_access = [];
     //    foreach($admin_access as $k=>$v){
     //        if(in_array($v['role_name'],$role_name)){
     //            $key = array_search($v['role_name'],$role_name);            
     //            $role_access[$key]['id'] = $role_access[$key]['id'].','.$v['id'];
     //            $role_access[$key]['role'] = $v['role_name'];
     //        }else{
     //            $role_name[] = $v['role_name'];
     //            $key = array_search($v['role_name'],$role_name);
     //            $role_access[$key]['id'] = $v['id'];
     //            $role_access[$key]['role'] = $v['role_name'];
     //        }
     //    }
     //    $id=$role_access["0"]["id"];
     //    $id=explode(",",$id);
     //    $_SESSION["node_id"]=$id;

    }
}